﻿using System.Drawing;

namespace Testing.Helpers.Images
{
    public static class CropImageHelper
    {
        /// <summary>
        /// Cpors the image.
        /// </summary>
        /// <param name="img">Source image.</param>
        /// <param name="cropArea">Crop rectangle.</param>
        /// <returns>Cropped image.</returns>
        public static Image CropImage(Image img, Rectangle cropArea)
        {
            var bmpImage = new Bitmap(img);
            Bitmap bmpCrop = bmpImage.Clone(cropArea, bmpImage.PixelFormat);
            return bmpCrop;
        }
    }
}
